<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<base href="<%=basePath%>">
	<title>hr-m-s</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/style.css" >
</head>
<body>
<table width="900" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <th colspan="6" scope="col">薪资发放历史记录</th>
  </tr>
  <tr>
    <td colspan="6">
    	<form id="search_form" name="search_form" method="post" action="salary!search" onsubmit="javascript:return checkForm();">
	    	薪资所属年月：
	    	    <select id="searchYear" name="searchYear">
	    	    	<option value="0">请选择</option>
	    	    	<s:bean name="org.apache.struts2.util.Counter" var="yearCounter">
					    <s:param name="first" value="2000" />
					    <s:param name="last" value="2050" />
					    <s:iterator>
					        <s:if test="searchYear == #yearCounter.current-1">
					    		<option value="<s:property/>" selected="selected"><s:property/></option>
					    	</s:if>
					    	<s:else>
					    		<option value="<s:property/>"><s:property/></option>
					    	</s:else>
					    </s:iterator>
				 	</s:bean>
	    	    </select>年
	    	    <select id="searchMonth" name="searchMonth">
	    	    	<option value="0">请选择</option>
	    	    	<s:bean name="org.apache.struts2.util.Counter" var="monthCounter">
					    <s:param name="first" value="1" />
					    <s:param name="last" value="12" />
					    <s:iterator>
					    	<s:if test="searchMonth == #monthCounter.current-1">
					    		<option value="<s:property/>" selected="selected"><s:property/></option>
					    	</s:if>
					    	<s:else>
					    		<option value="<s:property/>"><s:property/></option>
					    	</s:else>
					    </s:iterator>
				 	</s:bean>
	    	    </select>月&nbsp;&nbsp;&nbsp;
	    	<input name="search" type="submit" id="search" value="搜索"/>
	    	<input name="nowPage" id="nowPage" type="hidden" value="1"/>
    	</form>
    </td>
  </tr>
  <tr>
    <td width="100">编号</td>
    <td width="100">员工号</td>
    <td width="300">实际发放</td>
    <td width="50">薪资所属年月</td>
    <td width="50">发放时间</td>
    <td width="50">详细</td>
  </tr>
  <s:iterator value="salaryList" var="list" status="st">
	  <tr>
	    <td><s:property value="#st.count"/></td>
	    <td><s:property value="staffID"/></td>
	    <td><s:property value="remainSalary"/></td>
	    <td><s:date name="salaryBelongDate" format="yyyy-MM-dd"/></td>
	    <td><s:date name="salaryCreateDate" format="yyyy-MM-dd HH:mm:ss"/></td>
    	<td><a href='salary!detail?salaryID=<s:property value="salaryID"/>'>详细</a></td>
      </tr>
  </s:iterator>
  <tr>
    <td colspan="6">
      	第<s:property value="nowPage"/>/<s:property value="pageCount"/>页&nbsp;&nbsp;
      	<s:if test="nowPage == 1">
      		<a>首页</a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick="javascript:postForm(1);">首页</a>&nbsp;&nbsp;
      	</s:else>
      	<s:if test="nowPage == 1">
      		<a>上一页 </a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick='javascript:postForm(<s:property value="nowPage-1"/>);'>上一页</a>&nbsp;&nbsp;
      	</s:else>
      	<s:if test="nowPage == pageCount">
      		<a>下一页 </a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick='javascript:postForm(<s:property value="nowPage+1"/>);'>下一页</a>&nbsp;&nbsp;
      	</s:else>
      	<s:if test="nowPage == pageCount">
      		<a>尾页 </a>&nbsp;&nbsp;
      	</s:if>
      	<s:else>
      		<a href="javascript:void(0);" onclick='javascript:postForm(<s:property value="pageCount"/>);'>尾页</a>&nbsp;&nbsp;
      	</s:else>
      	
	</td>
  </tr>
</table>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div id="showMessage" align="center"><s:property value="messageTips" /></div>
<script type="text/javascript">
function $(value){
	return document.getElementById(value);
}
function checkForm(){
	if($("searchYear").selectedIndex == 0){
		alert("请选择检索年份！");
		$("searchYear").focus();
		return false;
	}
	if($("searchMonth").selectedIndex == 0){
		alert("请选择检索月份！");
		$("searchMonth").focus();
		return false;
	}
	return true;
}
function postForm(pageID){
	$("nowPage").value = pageID;
	var myForm = $("search_form");
	myForm.submit();
}
</script>
</body>
</html>
